package download

import (
	"gitee.com/injoyai/goutil/conv"
	"gitee.com/injoyai/goutil/string/color"
)

type Option struct {
	Limit    uint
	Retry    uint
	BarColor color.Color
	BarStyle string
}

func (this *Option) new() *Option {
	this = conv.Select(this == nil, new(Option), this).(*Option)
	return &Option{
		Limit:    conv.SelectVar(this.Limit > 0, this.Limit, 20).Uint(),
		Retry:    conv.SelectVar(this.Limit > 0, this.Limit, 20).Uint(),
		BarColor: this.BarColor,
		BarStyle: conv.SelectString(len(this.BarStyle) == 0, ">", this.BarStyle),
	}
}
